package com.itheima.exerciseTest.method20_29.method26;

import java.util.ArrayList;

public class Foodie implements Runnable {
    private Storefront sf;

    private static final Object lock = new Object();
    public Foodie(Storefront sf){
        this.sf = sf;
    }
    @Override
    public void run() {
        while(true){
            synchronized (sf.getLock()){
                ArrayList<String> al = sf.getAl();
                if(al.size() <= 0){
                    sf.getLock().notifyAll();
                }else{
                    al.remove(0);
                    sf.setAl(al);
                }
            }
        }
    }
}
